//
//  HJPasswordTipView.m
//  KaiChat
//
//  Created by lx on 2023/10/17.
//

#import "HJPasswordTipView.h"
#import "QMUIButton.h"

@implementation HJPasswordTipView {
    UILabel *__weak _titleLabel;
}

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
        self.backgroundColor = UIColorMake(0xFFF8F1);
        self.addCornerRadius(10);
        [self clipsToBounds];
        
        UIImageView *iconImageView = [UIImageView addToView:self];
        iconImageView.image = [UIImage imageNamed:@"warn_icon"];
        [iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.offset(15);
            make.centerY.offset(0);
            make.width.height.offset(20);
        }];
        
        UILabel *titleLabel = [UILabel lableWithSuperView:self font:UIFontMake(12) color:UIColor.tj_FF5100Color title:nil textAlignment:NSTextAlignmentLeft];
        titleLabel.numberOfLines = 0;
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.bottom.inset(10);
            make.left.equalTo(iconImageView.mas_right).offset(10);
            make.right.inset(42);
        }];
        
        [self mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(titleLabel).offset(10);
        }];
        
        QMUIButton *closeButton = [QMUIButton addToView:self];
        [closeButton setImage:[UIImage imageNamed:@"tipClose"] forState:UIControlStateNormal];
        [closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.top.inset(10);
            make.width.height.offset(20);
        }];
        _titleLabel = titleLabel;
        self -> _closeButton = closeButton;
    }
    return self;
}


- (void)setText:(NSString *)text {
    _text = text;
    
    _titleLabel.text = text;
    

}


@end
